<?php

/**
 * LigneFactureFournisseur form base class.
 *
 * @method LigneFactureFournisseur getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseLigneFactureFournisseurForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'designation'            => new sfWidgetFormInputText(),
      'taux_remise'            => new sfWidgetFormInputText(),
      'quantite_livre'         => new sfWidgetFormInputText(),
      'quantite'               => new sfWidgetFormInputText(),
      'quantite_rendue'        => new sfWidgetFormInputText(),
      'poids_net'              => new sfWidgetFormInputText(),
      'poids_brut'             => new sfWidgetFormInputText(),
      'prix_unitaire_ht'       => new sfWidgetFormInputText(),
      'prix_total_ht'          => new sfWidgetFormInputText(),
      'prix_total_ttc'         => new sfWidgetFormInputText(),
      'prix_total_ttcnet'      => new sfWidgetFormInputText(),
      'prix_tva'               => new sfWidgetFormInputText(),
      'stock_article_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('StockArticle'), 'add_empty' => true)),
      'article_serie_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ArticleSerie'), 'add_empty' => true)),
      'facture_fournisseur_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('FactureFournisseur'), 'add_empty' => false)),
      'tva_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tva'), 'add_empty' => true)),
      'maintenance_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Maintenance'), 'add_empty' => true)),
      'departement_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'unite_logistique_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UniteLogistique'), 'add_empty' => true)),
      'r'                      => new sfWidgetFormInputText(),
      'q'                      => new sfWidgetFormInputText(),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
      'deleted_at'             => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'designation'            => new sfValidatorString(array('max_length' => 100)),
      'taux_remise'            => new sfValidatorNumber(),
      'quantite_livre'         => new sfValidatorNumber(),
      'quantite'               => new sfValidatorNumber(),
      'quantite_rendue'        => new sfValidatorNumber(),
      'poids_net'              => new sfValidatorNumber(),
      'poids_brut'             => new sfValidatorNumber(),
      'prix_unitaire_ht'       => new sfValidatorNumber(),
      'prix_total_ht'          => new sfValidatorNumber(),
      'prix_total_ttc'         => new sfValidatorNumber(),
      'prix_total_ttcnet'      => new sfValidatorNumber(),
      'prix_tva'               => new sfValidatorNumber(),
      'stock_article_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('StockArticle'), 'required' => false)),
      'article_serie_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ArticleSerie'), 'required' => false)),
      'facture_fournisseur_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('FactureFournisseur'))),
      'tva_id'                 => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Tva'), 'required' => false)),
      'maintenance_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Maintenance'), 'required' => false)),
      'departement_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'required' => false)),
      'unite_logistique_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('UniteLogistique'), 'required' => false)),
      'r'                      => new sfValidatorInteger(),
      'q'                      => new sfValidatorNumber(),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
      'deleted_at'             => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ligne_facture_fournisseur[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LigneFactureFournisseur';
  }

}
